package cn.tedu.pet.controller;

import cn.tedu.pet.entity.User;
import cn.tedu.pet.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @title:
 * @Author: Huxiuyuan
 * @Date: 2021/10/20 19:59
 */
@RestController
@RequestMapping("/user/")
public class UserController {
    @Autowired(required = false)
    UserMapper mapper;

    @RequestMapping("login")
    public int reg(User user){
        User u = mapper.check(user.getUsername());
        if(u==null){
            mapper.UserInsert(user);
            return 1;//登录成功
        }else{
            return 2;//密码错误
        }

    }
}
